<?php

namespace App\HttpController\Home;

use App\HttpController\BaseController;
use App\Model\Admins\AdminsBean;
use App\Model\Admins\AdminsModel;
use App\Utility\Filesystem;
use App\Utility\MiniProgram;
use App\Utility\RedisTools;
use EasySwoole\EasySwoole\Logger;
use easySwoole\Cache\Cache;
use EasySwoole\Utility\File;
use Carbon\Carbon;

class Index extends BaseController {

    public function index(){

        $params = [
            'id' => 1,
        ];
        $update = [
            'username' => 'admin',
            'nickname' => '超管',
            'password' => password_hash('123456', PASSWORD_DEFAULT),
            'role_id'  => 1,
        ];
        $bean = new AdminsBean($params);
        $model = new AdminsModel();
        $res = $model->update($bean,$update);
        return $this->writeJson(200,$bean,'SUCCESS');
    }


    public function upload(){
        $request = $this->request();
        $files = $request->getUploadedFile('pic');
        $file = (new Filesystem($files))->qiNiuAs();
        return $this->writeJson(200,$file,'New Hello World!!!');
    }
}

